import uuid

from rest_framework import serializers
from doctor.models import Hospital, Doctor, History1, History2, History3

class HospitalSerializer(serializers.ModelSerializer):
    class Meta:
        model = Hospital
        fields = "__all__"

class DoctorSerializer(serializers.ModelSerializer):
    hospital_name = serializers.CharField(source="hospital.name", read_only=True)
    department_name = serializers.CharField(source="department.name", read_only=True)
    category_display = serializers.CharField(source="get_category_display", read_only=True)

    class Meta:
        model = Doctor
        fields = "__all__"

class History1Serializer(serializers.ModelSerializer):
    doctor_name = serializers.CharField(source="doctor.name", read_only=True)
    doctor_department = serializers.CharField(source="doctor.department.name", read_only=True)
    doctor_hospital = serializers.CharField(source="doctor.hospital.name", read_only=True)
    doctor_avatar = serializers.ImageField(source="doctor.doctor_avatar", read_only=True)

    class Meta:
        model = History1
        fields = "__all__"

class History2Serializer(serializers.ModelSerializer):
    doctor_name = serializers.CharField(source="doctor.name", read_only=True)
    doctor_department = serializers.CharField(source="doctor.department.name", read_only=True)
    doctor_hospital = serializers.CharField(source="doctor.hospital.name", read_only=True)
    doctor_avatar = serializers.ImageField(source="doctor.doctor_avatar", read_only=True)

    class Meta:
        model = History2
        fields = "__all__"

class History3Serializer(serializers.ModelSerializer):
    doctor_name = serializers.CharField(source="doctor.name", read_only=True)
    doctor_department = serializers.CharField(source="doctor.department.name", read_only=True)
    doctor_hospital = serializers.CharField(source="doctor.hospital.name", read_only=True)
    doctor_avatar = serializers.ImageField(source="doctor.doctor_avatar", read_only=True)

    class Meta:
        model = History3
        fields = "__all__"
